package main;

import java.util.Stack;

public class MotorCautare {
protected final int MAX=100;
protected Ruta rute []= new Ruta [MAX];
protected int nrRute=0;
Stack btStack=new Stack();

public void adaugaRuta(String p, String d, int dist,boolean rutier, boolean feroviar, boolean fluvial){
	if(nrRute<MAX){
		Ruta z=new Ruta(p,d,dist,rutier,feroviar,fluvial);
	rute[nrRute]=z;
	nrRute++;
    }
	else System.out.println ("Nu mai poate fi adaugat nici o ruta");
}
	public void setup (){
		adaugaRuta (" Timisoara ","Biled" ,10 , true,true ,false ) ;
		adaugaRuta ("Biled" ,"Lovrin " ,7, true ,  true ,false) ;
		//mai trebuie
		}

	 public int match (String plecare , String destinatie ){
		 int dist=0;
		 for (int i=0;i<nrRute;i++){
			  if(rute[i].localitatePlecare.equals (plecare) && rute[i].localitateSosire.equals (destinatie) && rute[i].skip==false)
			  {
				  dist=rute[i].distanta;
				  rute[i].skip=true ;
				   }
				  }
				   return dist ;
				  }
	 Ruta find ( String from) {
		  Ruta r=null ;
		 for (int i=0;i<nrRute;i++){
		 if(rute[i].localitatePlecare.equals ( rute[i].localitatePlecare)&&rute[i].skip==false) {
		 r=new Ruta (rute[i].localitatePlecare, rute[i].localitateSosire, rute[i].distanta , rute[i].isRutier() ,rute[i].isFluvial() ,rute[i].isFeroviar()) ;
		 rute [i].skip=true ;
		 }
		 }
		  return r ;
		 }	
	 void calculRuta ( String from , String to ) {
		 int dist;
		 Ruta z ;
}
	 
	 
}


	 


